package com.curryfishinterface.Controller;

import com.curryfishinterface.Service.AvatarsService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@RestController
@RequestMapping("/avatar")
public class AvatarController {

    @Resource
    AvatarsService avatarsService;

    @GetMapping("/random")
    public void randomGetAvatar(@RequestParam int gender, HttpServletResponse response){
        try {
            avatarsService.getRandomAvatar(gender,response);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
